﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hotnet.Entity;
using Hotnet.Dal.NSDalNews;
using Hotnet.Entity.Enum;
using Hotnet.Entity.Search;

namespace Hotnet.Biz.NSBizNews
{

	public class BizNewsList : BaseBiz<NewsList>
	{
		private static DalNewsList db = new DalNewsList();
		public BizNewsList() : base(db) { }

		public NewsList[] List(int id)
		{
			return db.ListBy(x => x.NewsID == id);
		}

		public void Delete(int id, EnumNewsListType listType)
		{
			db.DeleteBy(x => x.NewsID == id && x.ListType == (int)listType);
		}

		public ViewNewsList[] List(SearchNewsList condition, int pageNo, int pageSize, out int totalCount)
		{
			return db.List(condition, pageNo, pageSize, out totalCount);
		}

		/// <summary>
		/// 列出视频各列表
		/// </summary>
		/// <param name="listType"></param>
		/// <param name="count"></param>
		/// <returns></returns>
		public ViewNewsList[] List(EnumNewsListType listType, int count)
		{
			int totalCount = 0;
			SearchNewsList condition = new SearchNewsList() { IsPublished = EnumPublishState.发布, OrderType = EnumOrder.添加时间, ListType = listType };
			return List(condition, 0, count, out totalCount);
		}

		/// <summary>
		/// 列出视频各列表（分类）
		/// </summary>
		/// <param name="listType"></param>
		/// <param name="count"></param>
		/// <returns></returns>
		public ViewNewsList[] List(EnumNewsListType listType, int categoryID, int count)
		{
			int totalCount = 0;
			SearchNewsList condition = new SearchNewsList() { IsPublished = EnumPublishState.发布, OrderType = EnumOrder.添加时间, ListType = listType, NewsCategroyId=categoryID };
			return List(condition, 0, count, out totalCount);
		}
	}
}
